<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<!--框架必需start-->
	<script type="text/javascript" src="<%=basePath%>libs/js/jquery.js"></script>
	<script type="text/javascript" src="<%=basePath%>libs/js/framework.js"></script>
	<link href="<%=basePath%>libs/css/import_basic.css" rel="stylesheet" type="text/css"/>
	<link rel="stylesheet" type="text/css" id="skin" prePath="<%=basePath%>"/>
	<link rel="stylesheet" type="text/css" id="customSkin"/>
	<!--框架必需end-->
	<link rel="stylesheet" type="text/css" href="<%=basePath%>css/pagestyle.css" />

<!--弹窗函数start-->
<script>
function openWin(){
	var diag = new top.Dialog();
	diag.Title = "添加分公司";
	diag.URL = "Company_addPage.action";
	diag.Width=800;
	diag.Height=420;
	diag.show();
}
$(function(){
		top.Dialog.close();
	});
</script>
<!--弹窗函数end-->
<script type="text/javascript">
function query(){
	var companyname = document.getElementById("companyname").value;
	
	encodeurl("Company_query.action",['companyname'],[companyname]);
}

function encodeurl(url,idarray,paraarray){
	var tmp_url=url+"?";
	for(var i=0;i<idarray.length;i++){
		tmp_url+=idarray[i];
		tmp_url+="=";
		tmp_url+=encodeURI(paraarray[i]);
		tmp_url+="&";
	}
	//alert(tmp_url);
	window.location.href=tmp_url;
}
</script>
</head>
<body>
<div id="scrollContent">
	<div class="box2" panelTitle="分公司列表">
	<div class="rbox_topcenter" style="margin-bottom:5px">
		<table border="0" cellpadding="0" cellspacing="0" width="100%">
			<tr>
				<td width="8%" align="right">分公司名称：</td>
				<td width="10%" align="left"><input type="text" id="companyname" name="companyname" value="${companyname}"/></td>
				<td width="7%" align="right"><button onclick='query();'><span class="icon_find">查询</span></button></td>
				<td align="right"><button onclick='openWin()'><span class="icon_page">创建分公司</span></button></td>
			</tr>
		</table>
	</div>
	<table class="tableStyle cusTreeTable" useColor="false" useHover="false" useClick="false">
		<tr>
			<th>分公司名称</th>
			<th>地址</th>
			<th>联系方式</th>
			<th>操作</th>
		</tr>
		<s:iterator value="pageBean.list">
			<tr>
				<td><s:property value="name"/></td>
				<td><s:property value="address"/></td>
				<td><s:property value="phone"/></td>				
				<td>
					<input type="button" value="修改 " onclick='top.Dialog.open({URL:"Company_modifyPage.action?id=<s:property value="id"/>",Title:"修改分公司信息 ",Width:800,Height:420});'/>
					<input type="button" value="删除 " onclick='top.Dialog.confirm("确定要删除此项吗？",function(){window.location="Company_delete.action?id=<s:property value="id"/>"});'/>		
				</td>
			</tr>
			
		</s:iterator>
	</table>
	<div class="float_right padding5 paging">
		<jsp:include page="/Page.jsp" flush="true" />
	</div>
	</div>
</div>				
</body>
</html>